Showing posts with label OS X. Show all posts
Showing posts with label OS X. Show all posts

2012-07-20

Scratch of the day - How to disable mouse gesture in Firefox on OS X

Starting from OS X snow leopard (10.6) to Lion (10.7), Firefox have a mouse gesture of swiping 2 fingers left as go back a page in history & swiping to the right as go forward a page in history. Some times it is too sensitive as I scroll up & down in text reading would also trigger this behavior. Then I need reload the page again to get back where am I.

Search in Google & Duckduckgo doesn't yield much useful instructions. But out of a sudden a bulb lights up, this could be due to the mouse gestures that is being mischievous all these times!

It turns out that turning off the "Swipe between pages" in Mouse -> More Gestures does disable this mischievous behavior. :)

Arrivederci !!!

2011-07-27

Perl - Apple finally bump Perl to 5.12.3

$ /usr/bin/perl -v

This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

Copyright 1987-2010, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Although this is not the latest of greatest but this is definitely better of version 5.10.0 :p

Adios !!!

2011-07-26

OSX - Macports upgrade outdated ports hits error

OS X Lion 10.7 just released and I've join in the club to upgrade my mac. As usual, macports needs to be refresh before knowing what it upgrade :
port -v selfupdate

Next, upgrade the ports as usual :

2011-04-18

Subversion - Branching and merging to release, stable or something else

Previously, we talk about the basic stuff of Subversion. This is still basic stuff :p


Is about managing source codes by branching. Branching is a way to have 2 or more sets of source code with each has it's own development, but eventually, merging them into the main trunk.

Example, in most development, we normally have "development" & "release" version. As word means, the "development" version is meant for development & testing. But the "release" version, would be the ultimate version that roll out for production use. For this example, "release" will be the trunk & "development" will be the branch.

A view of it :

web_blog(repository)
   |
   +release
   |  |
   |  +front_end
   |  |
   |  +engine
   | 
   | 
   +development
      |
      +front_end
      |
      +engine



To create this hierarchy :

2011-04-08

bash - working with ps

Platform :
FreeBSD

Objective :
To grab the process details of a pid, without resorting to parse the output of process status command , "ps" :
E.g.
ps aux | grep -i pid

2011-04-04

Bash - How to debug shell script

Although Bash will spit out the errors onto the screen whenever it hits one, but some times, we want to know what exactly was being done every single command it executed.

This is how to do it :
Before running the bash script, do a :
set -x
then run the script and it'll be tell every action that it performs.

This is especially useful when debugging logic.

After finding out what's wrong, this is how to turn it off :
set +x

Alternatively, to debug only when running this script, put the below line in the start of the script :
set -x
Arrivederci !!!

2011-03-07

2011-02-28

Perl - How to uninstall / delete Perl module

Installing Perl modules can use the cpanm utility, but how about removing Perl modules? App::pmuninstall module is the answer!

Installation :

$ cpanm App::pmuninstall
--> Working on App::pmuninstall
Fetching http://search.cpan.org/CPAN/authors/id/X/XA/XAICRON/App-
pmuninstall-0.16.tar.gz ... OK
Configuring App-pmuninstall-0.16 ... OK
Building and testing App-pmuninstall-0.16 ... OK
Successfully installed App-pmuninstall-0.16

Usage :

2011-02-21

Perl - How to find out what Core Modules installed

Perl comes with a set of core modules. Perl core modules comes with default installation.
E.g. :
- Env
- File::Spec
- File::Basename
- Time::localtime

These are just some of the gems to a system administrator. So, how to find out what core modules are included with your perl installation?




Here's how :

2011-02-18

FreeBSD - How to change screen to use BASH

Purpose :
Make screen, the virtual terminal program, changes the user's default shell from tcsh to BASH when starting.

Command :

2011-02-11

Bash - How to output all (stdout & stderr) into log file in Bash

Purpose :
When scripting Bash scripts, often we'll need to output all stdout & stderr of a particular command into a log file, for logging purposes or diagnostic purposes.






Command :

2011-02-07

FreeBSD - How to check device or CPU performance

Platform :
FreeBSD

Purpose :
Monitoring disk read/write activity.

Command :
iostat


Installation :
The "iostat" command comes with the base installation.

Useful switches :
-w == update frequency, in seconds
-d == only show devices, hdd related
-C == show CPU activity only

Example :

2011-02-04

ssh - How to pipe output from local to remote server

In Bash, with pipe (the "|" symbol) and ssh makes a good combination of server administration tool, securely. Some examples :

2011-01-14

OSX - How to maximize window using keyboard shortcut

By default, OSX does not comes with a shortcut, though there's a function for it. To make use of it, we'll need to assign a keyboard shortcut key to maximize or un-maximize window.








Here's how to do it :
  1. Open the "System Preferences"
  2. Under the "Hardware" section, click on "Keyboard"
  3. Next, click on "Keyboard Shortcuts" then "Application Shortcuts" (on the left hand box)
  4. Add a shortcut key by clicking on "+" symbol, on the bottom of the right hand box
  5. At the next dialog box, choose "All Applications" for "Application:"
  6. In the "Menu Title :" column, type in "Zoom"
  7. Click on the next column, "Keyboard Shortcut:", then press your preferred keyboard shortcut.
    E.g. Control + Option + Command + m (you didn't read wrongly, is 4 keys there :p)

    *** Avoid popular shortcut key, e.g. Command + v

Now, open an application and try the new keyboard shortcut key. Press the first time for maximized and the second time to return the previous size.

Nemaste !!!

2011-01-07

Bash - How to check the exit status of pipe command


Piping in bash commands are common.
Checking exit status of a command in bash scripting is essential.
How about checking exit status of the commands in a pipe?





Example:

2010-10-11

Subversion - How to use svn to manage source files

The "svn" command stands for Subversion. Subversion is commonly use to manage revisions of source files, e.g. configuration files & program source code. Subversion keeps revision what of have been change or committed into the repository. This is good when we accidentally change the source code and needs to roll back to the previous changes. It is also good for managing configuration files (e.g. /etc, /usr/local/etc) on servers as it provides revision control. We can roll back to the last working condition if we screw something up. :p

Here's how to start using svn to manage source files, for the first time :

2010-10-01

FreeBSD - How to watermark image or picture using command line

Watermark is a technique to impose image or words using light shades. Digital watermark on image is use for the purpose of copyrights, comments or notices. Watermark image can be accomplish using tools from Image Magick suite of programs.

Firstly, install the ImageMagick port using portmanager :
portmanager graphics/ImageMagick -l

2010-09-29

FreeBSD - The ps command output is truncated from the terminal width

There are a few commands that can list current process activity, "top" & "ps" are the most common one in use. The command "top" give an interactive view of the list of process running currently. But the command "ps" gives a more friendly output for scripting or text parsing. It also gives a lot of parameters to filter the output. One of the common parameters that I've always use is "ps aux". It list all the current process running with headers and information. By the way, "ps" stands for process status.

Usually, the process status output is pass to "less", a pager for ease of reading. Often, the "COMMAND" column of "ps aux" output, is truncated at the end of the terminal width. This behavior prevents the full process name from displaying. One thing good about this is, the output are not wrap so it won't mess up the output display. But most of the time, we'll want to view the full output.

There are 2 things to try in order to get the full output. First, try telling the pager (in this case, "less") don't chop the long lines after the terminal width, using parameter "-S".

2010-09-24

Macports - After installing git-core, all packages depends on libssl breaks

Git is popular. Is like LinkedIn to working professionals and GitHub to programmers.




Before I'm able to play around git on my mac, "git-core" need to be installed first, through macports. As usual, installing port from macports is as easy as :
port -v selfupdate
port -v install git-core

After the installation, time to try git. When issue the command "git", it return an error message :
dyld: Library not loaded: /opt/local/lib/libssl.0.9.8.dylib
Referenced from: /opt/local/bin/git
Reason: image not found
Trace/BPT trap

In fact, all my other programs that installed through macports are having problem.
e.g.
Executing "svn" also return the same error :
dyld: Library not loaded: /opt/local/lib/libssl.0.9.8.dylib
Referenced from: /opt/local/bin/svn
Reason: image not found
Trace/BPT trap

Looking at the error message, my guts tells me that libssl has problem working with these programs. After messing around with the OpenSSL port, here's the solution :